package cn.com.twoke.application.game.mario.game.entity;

import cn.com.twoke.application.game.mario.core.ecs.world.GameWorld;
import cn.com.twoke.application.game.mario.core.ecs.entity.Entity;

import java.util.function.Consumer;

public abstract class AbstractEntityBuilder<T extends AbstractEntityBuilder<T>> implements
        EntityBuilder<T>{

    protected final GameWorld world;

    protected int startX;
    protected int startY;
    protected Consumer<Entity> extend;

    public AbstractEntityBuilder(GameWorld world) {
        this.world = world;
    }

    protected T self() {
        return (T) this;
    }


    @Override
    public T startY(int y) {
        this.startY = y;
        return self();
    }

    @Override
    public T extend(Consumer<Entity> extend) {
        this.extend = extend;
        return self();
    }

    @Override
    public T startX(int x) {
        this.startX = x;
        return self();
    }

}
